package com.example.demo;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;

/**
 * @Description:
 * @Author: LiangJiawen
 * @Create Date Time: 2021/4/19 17:01.
 * @Update Date Time: 
 * @see
 */
@Component
public class TestBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        System.out.println("======【BeanFactory后置处理器】修改name属性值======" + beanFactory.toString());
        BeanDefinition beanDefinition = beanFactory.getBeanDefinition("myTest");
        beanDefinition.getPropertyValues().add("name", "张三");
    }
}
